package com.dkd.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.dkd.entity.OrderEntity;
import com.dkd.entity.OrderSkuVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDate;
import java.util.Date;
import java.util.List;

@Mapper
public interface OrderDao extends BaseMapper<OrderEntity> {

    List<Long> getByBId(Long businessId);
    @Select("select sku_name,count(*) count from lkd_order.tb_order " +
            "where inner_code = #{innerCode} and pay_status = 1 " +
            "and create_time between #{start} and #{end} " +
            "group by sku_name")
    List<OrderSkuVo> getSupplyCount(String innerCode, Date start, Date end);

    Long getAmount(Integer partnerId, String innerCode, LocalDate start, LocalDate end);

    List<OrderSkuVo> getBusinessTop10Skus(Integer topValue, LocalDate start, LocalDate end);
}
